//////////////////////////////////////
// Fast Container Library           //
// MIT License - Copyright (c) 2012 //
//////////////////////////////////////

#pragma once

#include "deque.h"

FC_NAMESPACE_BEGIN


template <class T, class Container>
class queue
{
public:
	typedef queue<T, Container>						this_type;
	typedef Container								container_type;
	typedef typename Container::allocator_type		allocator_type;
	typedef typename Container::value_type			value_type;
	typedef typename Container::size_type			size_type;
	typedef typename Container::pointer				pointer;
	typedef typename Container::const_pointer		const_pointer;
	typedef typename Container::iterator			iterator;
	typedef typename Container::const_iterator		const_iterator;

	queue() : c()
		{
		}

	explicit queue( const Container& container )
		: c(container)
		{
		}

	queue& operator =( const this_type& x )
	{
		if(&x != this)
			c = x.c;
		return *this;
	}

	void push( const T& value )	{ c.push_back(value); }
	void pop()					{ c.pop_front(); }
	void clear()				{ c.clear(); }
	void reserve( size_t n )	{ c.reserve(n); }

	T& front()					{ return c.front(); }
	const T& front() const		{ return c.front(); }
	T& back()					{ return c.back(); }
	const T& back() const		{ return c.back(); }

	bool empty() const			{ return c.empty(); }
	bool full() const			{ return c.full(); }
	size_t size() const			{ return c.size(); }
	size_t max_size() const		{ return c.max_size(); }

	iterator begin()				{ return c.begin(); }
	const_iterator begin() const	{ return c.begin(); }
	iterator end()					{ return c.end(); }
	const_iterator end() const		{ return c.end(); }

	void swap( this_type& x ) const { return c.swap(x.c); }

	//uninhibited container access for explicit usage.
	container_type& get_container()				{ return c; }
	const container_type& get_container() const	{ return c; }

protected:
	Container c;

};


FC_NAMESPACE_END
